
#ifndef __APTCAB_BIN_INDEX_HPP_2010__
#define __APTCAB_BIN_INDEX_HPP_2010__

#include <string>

#include "bocat/common/lrucache.hpp"

#include "recloc.hpp"


namespace   aptcab   {

#define DEFAULT_RCNUM  (1024 * 1024 * 2)
#define DEFAULT_BNUM   (1024 * 1024 * 1024)


class	TCAIndex
{
public  :
    virtual int put( const std::string& skey,
					    RecordLocation&  loc ) = 0;

    virtual int get( const std::string& skey,
						RecordLocation& loc ) = 0;

    virtual int erase( const std::string& skey ) = 0;


public	:
	virtual	~TCAIndex() {}
};	//// class TCAIndex


class   BinIndex
{

	//typedef	TCHDB *	dbp_type;
	//typedef	bocat::common::LRUCache< std::string, dbp_type >	dbp_cache_type;

public	:
	BinIndex( const char* ini_filename, const char* ini_section );
	~BinIndex();

public  :
    int put( const std::string& skey,
                RecordLocation&  loc );

    int get( const std::string& skey,
                RecordLocation& loc );

    int erase( const std::string& skey );


private	:
	TCAIndex*	_tc_p;

private	:
    //const std::string   getTableName( const std::string& kpin );

	//u_int32_t		getPinId( const std::string& kpin );
	//std::string		getTableName( u_int32_t pin );
	//u_int32_t		getTableId( u_int32_t pin );

private	:

	//u_int32_t		_n_tables;

	//dbp_cache_type	_dbp_cache;
	//boost::mutex	_dbp_cache_mutex;

	//dbp_type	openTable( const std::string& table_name );
	//void		closeAllTables();

	//dbp_type	getDbp();

};  //// class BinIndex


}   //// namespace aptcab


#endif  //// __APTCAB_BIN_INDEX_HPP_2010__


